{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([5.5000, 3.0000])\n"
     ]
    }
   ],
   "source": [
    "x = torch.tensor([5.5, 3])\n",
    "print(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[1., 1., 1.],\n",
      "        [1., 1., 1.],\n",
      "        [1., 1., 1.],\n",
      "        [1., 1., 1.],\n",
      "        [1., 1., 1.]], dtype=torch.float64)\n"
     ]
    }
   ],
   "source": [
    "x = x.new_ones(5, 3, dtype=torch.double) \n",
    "print(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = torch.randn_like(x, dtype=torch.float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[-1.9611, -0.4421, -0.3265],\n",
      "        [ 1.8987, -0.9870,  1.2782],\n",
      "        [-0.2431,  0.5186,  1.2357],\n",
      "        [ 1.1351, -0.1109, -1.6098],\n",
      "        [-0.2599, -0.4028, -0.0814]])\n"
     ]
    }
   ],
   "source": [
    "print(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([-0.4421, -0.9870,  0.5186, -0.1109, -0.4028])\n"
     ]
    }
   ],
   "source": [
    "print(x[:, 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[[[0.1863, 0.9872],\n",
      "          [0.7662, 0.1902],\n",
      "          [0.1925, 0.8392],\n",
      "          [0.2169, 0.0402],\n",
      "          [0.2557, 0.0657]],\n",
      "\n",
      "         [[0.2926, 0.4460],\n",
      "          [0.2814, 0.1667],\n",
      "          [0.7311, 0.7041],\n",
      "          [0.5028, 0.6114],\n",
      "          [0.9798, 0.8169]],\n",
      "\n",
      "         [[0.5906, 0.6512],\n",
      "          [0.6136, 0.6353],\n",
      "          [0.4465, 0.7177],\n",
      "          [0.1835, 0.6652],\n",
      "          [0.5011, 0.8043]],\n",
      "\n",
      "         [[0.2809, 0.4159],\n",
      "          [0.4534, 0.0419],\n",
      "          [0.6143, 0.2034],\n",
      "          [0.1268, 0.8203],\n",
      "          [0.7213, 0.1146]],\n",
      "\n",
      "         [[0.4153, 0.5085],\n",
      "          [0.9109, 0.6800],\n",
      "          [0.3473, 0.2354],\n",
      "          [0.0029, 0.8782],\n",
      "          [0.7142, 0.3934]],\n",
      "\n",
      "         [[0.7981, 0.0103],\n",
      "          [0.6163, 0.1717],\n",
      "          [0.9628, 0.1888],\n",
      "          [0.1183, 0.9014],\n",
      "          [0.9920, 0.8158]],\n",
      "\n",
      "         [[0.9745, 0.4073],\n",
      "          [0.6392, 0.8931],\n",
      "          [0.7365, 0.8366],\n",
      "          [0.7834, 0.1296],\n",
      "          [0.5655, 0.2776]]],\n",
      "\n",
      "\n",
      "        [[[0.5054, 0.1872],\n",
      "          [0.3947, 0.7005],\n",
      "          [0.0090, 0.6811],\n",
      "          [0.8742, 0.2294],\n",
      "          [0.1485, 0.9881]],\n",
      "\n",
      "         [[0.3877, 0.2587],\n",
      "          [0.0542, 0.2039],\n",
      "          [0.1559, 0.7359],\n",
      "          [0.1931, 0.8274],\n",
      "          [0.4658, 0.9169]],\n",
      "\n",
      "         [[0.9174, 0.4669],\n",
      "          [0.1484, 0.9948],\n",
      "          [0.8798, 0.5675],\n",
      "          [0.2216, 0.1690],\n",
      "          [0.8894, 0.5744]],\n",
      "\n",
      "         [[0.6817, 0.7364],\n",
      "          [0.0360, 0.4696],\n",
      "          [0.4832, 0.4125],\n",
      "          [0.1289, 0.4229],\n",
      "          [0.2734, 0.6763]],\n",
      "\n",
      "         [[0.1305, 0.9268],\n",
      "          [0.8797, 0.2443],\n",
      "          [0.1203, 0.3167],\n",
      "          [0.2941, 0.9312],\n",
      "          [0.0837, 0.4856]],\n",
      "\n",
      "         [[0.3712, 0.9658],\n",
      "          [0.1897, 0.5467],\n",
      "          [0.0987, 0.3116],\n",
      "          [0.4679, 0.6263],\n",
      "          [0.9289, 0.7432]],\n",
      "\n",
      "         [[0.8267, 0.8260],\n",
      "          [0.2516, 0.1774],\n",
      "          [0.8237, 0.4206],\n",
      "          [0.9701, 0.4467],\n",
      "          [0.9057, 0.3241]]],\n",
      "\n",
      "\n",
      "        [[[0.1357, 0.1252],\n",
      "          [0.9447, 0.5624],\n",
      "          [0.8343, 0.0613],\n",
      "          [0.9238, 0.1974],\n",
      "          [0.6878, 0.3996]],\n",
      "\n",
      "         [[0.7697, 0.9731],\n",
      "          [0.3540, 0.7979],\n",
      "          [0.1087, 0.6151],\n",
      "          [0.8487, 0.3855],\n",
      "          [0.2679, 0.7381]],\n",
      "\n",
      "         [[0.4321, 0.5847],\n",
      "          [0.4734, 0.1958],\n",
      "          [0.1187, 0.8916],\n",
      "          [0.2316, 0.5044],\n",
      "          [0.0311, 0.8037]],\n",
      "\n",
      "         [[0.6673, 0.9578],\n",
      "          [0.4634, 0.6346],\n",
      "          [0.1102, 0.7959],\n",
      "          [0.0290, 0.5186],\n",
      "          [0.6171, 0.0172]],\n",
      "\n",
      "         [[0.6302, 0.8087],\n",
      "          [0.4863, 0.4641],\n",
      "          [0.2516, 0.8639],\n",
      "          [0.8011, 0.6889],\n",
      "          [0.9370, 0.1485]],\n",
      "\n",
      "         [[0.8742, 0.2908],\n",
      "          [0.1033, 0.5662],\n",
      "          [0.1794, 0.2636],\n",
      "          [0.5666, 0.9013],\n",
      "          [0.3485, 0.7168]],\n",
      "\n",
      "         [[0.5410, 0.5442],\n",
      "          [0.6845, 0.2945],\n",
      "          [0.0562, 0.5664],\n",
      "          [0.4435, 0.7229],\n",
      "          [0.2617, 0.9417]]]])\n"
     ]
    }
   ],
   "source": [
    "a=torch.rand(3,7,5,2)\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([3, 7, 5, 2])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.size()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "torch.Size([7, 5, 2])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.size()[1:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
